
import { User, Lock, EditPen, Avatar } from '@element-plus/icons-vue'
import { IForm } from '@/components/form'

export const loginFormConfig: IForm = {
  rules: {
    username: [
      { required: true, message: '请输入用户名', trigger: 'blur' },
      { min: 3, max: 12, message: '长度应为3 ~ 12位', trigger: 'blur' }
    ],
    password: [
      { required: true, message: '请输入密码', trigger: 'blur' },
      { min: 6, max: 18, message: '长度应为6 ~ 18位', trigger: 'blur' }
    ]
  },
  labelWidth: 0,
  formItems: [
    {
      type: 'input',
      field: 'username',
      prop: 'username',
      required: true,
      otherOptions: {
        'prefix-icon': User,
        placeholder: "请输入用户名",
        autocomplete: "off"
      }
    },
    {
      type: 'password',
      field: 'password',
      prop: 'password',
      required: true,
      otherOptions: {
        'prefix-icon': Lock,
        placeholder: "请输入密码",
        autocomplete: "off",

      }
    }
  ],
  btns: [
    { name: '登录', action: 'chatLogin', otherOptions: { type: 'primary', plain: 'plain' }, needValid: true },
    { name: '注册', action: 'goRegister', otherOptions: { plain: 'plain' }, needValid: false }
  ]
}

export const registerFormConfig: IForm = {
  rules: {
    username: [
      { required: true, message: '请输入用户名', trigger: 'blur' },
      { min: 3, max: 12, message: '长度应为3 ~ 12位', trigger: 'blur' }
    ],
    password: [
      { required: true, message: '请输入密码', trigger: 'blur' },
      { min: 6, max: 18, message: '长度应为6 ~ 18位', trigger: 'blur' }
    ]
  },
  labelWidth: 0,
  formItems: [
    {
      type: 'input',
      field: 'username',
      prop: 'username',
      required: true,
      otherOptions: {
        'prefix-icon': User,
        placeholder: "请输入用户名",
        autocomplete: "off"
      }
    },
    {
      type: 'password',
      field: 'password',
      prop: 'password',
      required: true,
      otherOptions: {
        'prefix-icon': Lock,
        placeholder: "请输入密码"
      }
    },
    {
      type: 'input',
      field: 'nickname',
      otherOptions: {
        'prefix-icon': Avatar,
        placeholder: "请输入昵称"
      }
    },
    {
      type: 'input',
      field: 'signature',
      otherOptions: {
        'prefix-icon': EditPen,
        placeholder: "请输入个性签名"
      }
    },
  ],
  btns: [
    { name: '提交', action: 'chatRegister', otherOptions: { type: 'primary', plain: 'plain' }, needValid: true },
    { name: '取消', action: 'goLogin', otherOptions: { plain: 'plain' }, needValid: false }
  ]
}
